// 拼接静态路由和动态路由
import { constantRoutes } from '@/router/index'

export default {
  namespaced: true, // 开启命名空间
  state: () => ({
    routes: constantRoutes // 合并后的路由 constantRoutes是静态路由
  }),
  mutations: {
    //   第二个值是动态路由
    setRoutes(state, asyncRoutes) {
      state.routes = [...constantRoutes, ...asyncRoutes]
    }
  }
}
